package cn.hpe.po;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * Datatype entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "datatype")
public class Datatype implements java.io.Serializable {

	// Fields

	private Integer dtid;
	private String dtname;
	private Integer dtparentId;
	private Set<Datainfo> datainfos = new HashSet<Datainfo>(0);

	// Constructors

	/** default constructor */
	public Datatype() {
	}

	/** full constructor */
	public Datatype(String dtname, Integer dtparentId, Set<Datainfo> datainfos) {
		this.dtname = dtname;
		this.dtparentId = dtparentId;
		this.datainfos = datainfos;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "DTId", unique = true, nullable = false)
	public Integer getDtid() {
		return this.dtid;
	}

	public void setDtid(Integer dtid) {
		this.dtid = dtid;
	}

	@Column(name = "DTName", length = 50)
	public String getDtname() {
		return this.dtname;
	}

	public void setDtname(String dtname) {
		this.dtname = dtname;
	}

	@Column(name = "DTParentId")
	public Integer getDtparentId() {
		return this.dtparentId;
	}

	public void setDtparentId(Integer dtparentId) {
		this.dtparentId = dtparentId;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "datatype")
	public Set<Datainfo> getDatainfos() {
		return this.datainfos;
	}

	public void setDatainfos(Set<Datainfo> datainfos) {
		this.datainfos = datainfos;
	}

}